<template>
  <!-- 2容器 -->
  <div class="charts" ref="charts"></div>
</template>

<script>
import echarts from 'echarts' //1引入
export default {
  name: '',
  mounted() {
    //   3初始化实例
    let lineCharts = echarts.init(this.$refs.charts)
    //配置
    lineCharts.setOption({
      xAxis: {
        show: false,
        type: 'category',
      },
      yAxis: {
        show: false,
      },
      series: {
        type: 'line',
        data: [10, 7, 33, 12, 48, 9, 29, 10, 44],
        itemStyle: {
          opacity: 0,
        },
        lineStyle: {
          color: 'purple',
        },
        smooth: true,
        areaStyle: {
          color: {
            type: 'purple',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: 'purple', // 0% 处的颜色
              },
              {
                offset: 1,
                color: '#fff', // 100% 处的颜色
              },
            ],
            global: false, // 缺省为 false
          },
        },
      },
      grid: {
        left: 0,
        top: 0,
        bottom: 0,
        right: 0,
      },
    })
  },
}
</script>

<style scoped>
.charts {
  width: 100%;
  height: 100%;
}
</style>
